package com.zwr.normal.sharemodel.field;

import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

public class FieldTest {
    private volatile int field;

    public static void main(String[] args) {
        AtomicIntegerFieldUpdater<FieldTest> fieldUpdater = AtomicIntegerFieldUpdater.newUpdater(FieldTest.class, "field");
        FieldTest fieldTest = new FieldTest();

        fieldUpdater.compareAndSet(fieldTest,0,10);
        System.out.println();
        fieldUpdater.compareAndSet(fieldTest,0,20);

    }
}
